/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-04-01
 * Time: 22:54
 */
public class Demo3 {
    public static void main(String[] args) {
        Object locker = new Object();
        Object locker2 = new Object();
        Thread t1=new Thread(()->{
            synchronized(locker){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                synchronized (locker2){
                    System.out.println("锁竞争引起的等待");
                }

            }
        });
        Thread t2=new Thread(()->{
            synchronized (locker2){
                synchronized (locker){

                }
            }
        });
        t1.start();
        t2.start();



    }
}
